<script setup>
  const props = defineProps({
    prefix: {
      type: String,
      default: 'icon',
    },
    name: {
      type: String,
      required: true,
    },
    color: {
      type: String,
    },
    size: {
      type: String,
      default: '1em',
    },
    width: {
      type: String,
      default: '1em',
    },
    height: {
      type: String,
      default: '1em',
    },
  });

  const symbolId = computed(() => `#${props.prefix}-${props.name}`);
  const svgClass = computed(() => (props.name ? `svg-icon icon-${props.name}` : 'svg-icon'));
</script>

<template>
  <svg aria-hidden="true" v-bind="$attrs" :class="svgClass" :style="{ width: props.width, height: props.height, fill: props.color }">
    <use :xlink:href="symbolId" :fill="color" />
  </svg>
</template>
<style lang="scss">
  .svg-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
  }
</style>
